<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<link rel="stylesheet" type="text/css" href="../js/layui/css/layui.css" />
		<link rel="stylesheet" type="text/css" href="../css/common.css" />
		<script src="../js/jquery.min.js"></script>
		<script src="../js/layui/layui.js"></script>
		<script src="../js/common.js"></script>
		<style type="text/css">
			.layui-layer-content{
				border-bottom: 1px solid #eee;
			}
		</style>
	</head>

	<body>
		<button id="btn51" onclick="ajaxLayer1()">动态添加弹窗</button>
		<button id="btn51" onclick="ajaxLayer2()">动态添加弹窗(有数据)</button>
		<script type="text/javascript">
			var ajaxLayer1 = function() {
				layer.open({
					type: 1,
					async: true, //异步请求,content为请求地址
					content: '../template/xx.tpl',
					btn: ['按钮一', '按钮二', '按钮三'],
					success: function(layero, index) {
						console.log(layero, index);
					}
				})
			}
			var ajaxLayer2 = function() {
				layer.open({
					type: 1,
					async: true, //异步请求,content为请求地址
					data: {
						v1: '数据一'
					},
					btn: ['按钮一', '按钮二', '按钮三'],
					content: '../template/xx.tpl',
					success: function(layero, index) {
						console.log(layero, index);
					}
				})
			}
		</script>
	</body>

</html>